/* GUI CONVERTED from relbra.p (converter v1.76) Mon Jul 30 17:45:39 2001 */
/* relbra.p - REPETITIVE                                                     */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                       */
/* All rights reserved worldwide.  This is an unpublished work.              */
/* $Revision: 1.12 $                                               */
/* REVISION: 7.3      LAST MODIFIED: 10/31/94   BY: WUG *GN77*               */
/* REVISION: 8.5      LAST MODIFIED: 10/24/95   BY: taf *J053*               */
/* REVISION: 7.3      LAST MODIFIED: 12/12/95   BY: bcm *G1DD*               */
/* REVISION: 8.5      LAST MODIFIED: 05/16/96   BY: *G1VQ* Julie Milligan    */
/* REVISION: 9.0      LAST MODIFIED: 04/16/99   BY: *J2DG* Reetu Kapoor      */
/* REVISION: 9.1      LAST MODIFIED: 10/01/99   BY: *N014* Jeff Wootton      */
/* REVISION: 9.1      LAST MODIFIED: 11/17/99   BY: *N04H* Vivek Gogte       */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KP* myb               */
/* Old ECO marker removed, but no ECO header exists *F0PN*                   */
/* $Revision: 1.12 $   BY: Niranjan R.  DATE: 07/13/01 ECO: *P00L*   */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/
/*V8:ConvertMode=Maintenance                                                  */

/* GROUPED MULTIPLE FIELD ASSIGNMENTS INTO ONE AND ADDED NO-UNDO          */
/* WHEREVER MISSING AND REPLACED FIND STATEMENTS WITH FOR FIRST           */
/* STATEMENTS FOR ORACLE PERFORMANCE.                                     */

/* SUBPROGRAM TO POST LABOR/BURDEN                                        */

{mfdeclre.i}

define input parameter     cumwo_lot      as character no-undo.
define input parameter     cumwo_op       as integer   no-undo.
define input parameter     wkctr          as character no-undo.
define input parameter     mch            as character no-undo.
define input parameter     dept           as character no-undo.
define input parameter     act_lbr_hrs    as decimal   no-undo.
define input parameter     eff_date       as date      no-undo.
define input parameter     earn_code      as character no-undo.
define input parameter     emp            as character no-undo.
define input parameter     run_labor      like mfc_logical no-undo.
define input parameter     ophist_recid   as recid     no-undo.

define new shared variable op_recno       as recid.
define new shared variable opgltype       like opgl_type.
define new shared variable ref            like glt_ref.
define new shared variable sf_cr_acct     like dpt_lbr_acct.
define new shared variable sf_cr_sub      like dpt_lbr_sub.
define new shared variable sf_cr_cc       like dpt_lbr_cc.
define new shared variable sf_dr_acct     like dpt_lbr_acct.
define new shared variable sf_dr_sub      like dpt_lbr_sub.
define new shared variable sf_dr_cc       like dpt_lbr_cc.
define new shared variable sf_entity      like en_entity.
define new shared variable sf_gl_amt      like glt_amt.
define            variable bdn_act_amt    like glt_amt no-undo.
define            variable bdn_wc_std_amt like glt_amt no-undo.
define            variable bdn_method_var like glt_amt no-undo.
define            variable bdn_rate_acct  like dpt_bvrr_acc no-undo.
define            variable bdn_rate_sub   like dpt_bvrr_sub no-undo.
define            variable bdn_rate_cc    like dpt_bvrr_cc  no-undo.
define            variable bdn_rate_var   like glt_amt no-undo.
define            variable bdn_cumorder_std_amt like glt_amt no-undo.
define            variable bdn_use_acct   like dpt_bvar_acc  no-undo.
define            variable bdn_use_sub    like dpt_bvar_sub  no-undo.
define            variable bdn_use_cc     like dpt_bvar_cc   no-undo.
define            variable cur_mthd       like cs_method no-undo.
define            variable cur_set        like cs_set    no-undo.
define            variable glx_mthd       like cs_method no-undo.
define            variable glx_set        like cs_set    no-undo.
define            variable lbr_act_amt    like glt_amt   no-undo.
define            variable lbr_wc_std_amt like glt_amt   no-undo.
define            variable lbr_method_var like glt_amt   no-undo.
define            variable lbr_rate_acct  like dpt_lvrr_acc no-undo.
define            variable lbr_rate_sub   like dpt_lvrr_sub no-undo.
define            variable lbr_rate_cc    like dpt_lvrr_cc  no-undo.
define            variable lbr_rate_var   like glt_amt   no-undo.
define            variable lbr_cumorder_std_amt like glt_amt no-undo.
define            variable lbr_use_acct   like dpt_lvar_acc  no-undo.
define            variable lbr_use_sub    like dpt_lvar_sub  no-undo.
define            variable lbr_use_cc     like dpt_lvar_cc   no-undo.
define            variable mch_op         like wr_mch_op no-undo.
define            variable pay_rate       as decimal     no-undo.
define            variable routing        as character   no-undo.
define            variable sf_bdn_acct    like dpt_bdn_acct no-undo.
define            variable sf_bdn_sub     like dpt_bdn_sub  no-undo.
define            variable sf_bdn_cc      like dpt_bdn_cc   no-undo.
define            variable sf_cop_acct    like dpt_cop_acct no-undo.
define            variable sf_cop_sub     like dpt_cop_sub  no-undo.
define            variable sf_cop_cc      like dpt_cop_cc   no-undo.
define            variable sf_lbr_acct    like dpt_lbr_acct no-undo.
define            variable sf_lbr_sub     like dpt_lbr_sub  no-undo.
define            variable sf_lbr_cc      like dpt_lbr_cc   no-undo.
define            variable sf_wip_acct    like dpt_lbr_acct no-undo.
define            variable sf_wip_sub     like dpt_lbr_sub  no-undo.
define            variable sf_wip_cc      like dpt_lbr_cc   no-undo.
define            variable trans_type     as character      no-undo.

{gpcrnd.i}

if act_lbr_hrs = 0 then leave.

/* NO TRANSACTION SHOULD BE PENDING HERE */

do transaction:

   for first wo_mstr
         fields (wo_acct
         wo_sub
         wo_cc wo_lot wo_part wo_routing
         wo_site wo_wip_tot)
         where wo_lot = cumwo_lot no-lock:
   end. /* FOR FIRST WO_MSTR */

   for first wr_route
         fields (wr_act_run wr_act_setup wr_bdn_act wr_bdn_pct
         wr_bdn_rate wr_bdn_std wr_lbr_act wr_lbr_rate
         wr_lbr_std wr_lot wr_mch_bdn wr_mch_op
         wr_op wr_setup_rte)
         where wr_lot = wo_lot
         and wr_op  = cumwo_op no-lock:
   end. /* FOR FIRST WR_ROUTE */

   for first wc_mstr
         fields (wc_bdn_pct wc_bdn_rate wc_lbr_rate wc_mch
         wc_mch_bdn wc_mch_op wc_setup_rte wc_wkctr)
         where wc_wkctr = wkctr
         and wc_mch   = mch no-lock:
   end. /* FOR FIRST WC_MSTR */

   for first dpt_mstr
         fields (dpt_bdn_acct
         dpt_bdn_sub
         dpt_bdn_cc dpt_bvar_acc
         dpt_bvar_sub
         dpt_bvar_cc
         dpt_bvrr_acc
         dpt_bvrr_sub
         dpt_bvrr_cc dpt_dept dpt_lbr_acct
         dpt_lbr_sub
         dpt_lbr_cc dpt_lvar_acc
         dpt_lvar_sub
         dpt_lvar_cc dpt_lvrr_acc
         dpt_lvrr_sub
         dpt_lvrr_cc)
         where dpt_dept = dept no-lock:
   end. /* FOR FIRST DPT_MSTR */

   for first pt_mstr
         fields (pt_part pt_prod_line)
         where pt_part = wo_part no-lock:
   end. /* FOR FIRST PT_MSTR */

   for first pl_mstr
         fields (pl_prod_line pl_wvar_acct
         pl_wvar_sub
         pl_wvar_cc)
         where pl_prod_line = pt_prod_line no-lock:
   end. /* FOR FIRST PL_MSTR */

   /*GET ACCOUNT NUMBERS*/

   for first gl_ctrl
         fields (gl_bdn_acct
         gl_bdn_sub
         gl_bdn_cc gl_bvar_acct
         gl_bvar_sub
         gl_bvar_cc
         gl_bvrr_acct
         gl_bvrr_sub
         gl_bvrr_cc gl_cop_acct
         gl_cop_sub
         gl_cop_cc
         gl_lbr_acct
         gl_lbr_sub
         gl_lbr_cc gl_lvar_acct
         gl_lvar_sub
         gl_lvar_cc
         gl_lvrr_acct
         gl_lvrr_sub
         gl_lvrr_cc gl_rnd_mthd gl_wip_acct
         gl_wip_sub
         gl_wip_cc) no-lock:
   end. /* FOR FIRST GL_CTRL */

   assign
      sf_lbr_acct = gl_lbr_acct
      sf_lbr_sub = gl_lbr_sub
      sf_lbr_cc = gl_lbr_cc
      sf_bdn_acct = gl_bdn_acct
      sf_bdn_sub = gl_bdn_sub
      sf_bdn_cc = gl_bdn_cc
      sf_cop_acct = gl_cop_acct
      sf_cop_sub = gl_cop_sub
      sf_cop_cc = gl_cop_cc

      lbr_use_acct = gl_lvar_acct
      lbr_use_sub = gl_lvar_sub
      lbr_use_cc = gl_lvar_cc
      lbr_rate_acct = gl_lvrr_acct
      lbr_rate_sub = gl_lvrr_sub
      lbr_rate_cc = gl_lvrr_cc
      bdn_use_acct = gl_bvar_acct
      bdn_use_sub = gl_bvar_sub
      bdn_use_cc = gl_bvar_cc
      bdn_rate_acct = gl_bvrr_acct
      bdn_rate_sub = gl_bvrr_sub
      bdn_rate_cc = gl_bvrr_cc
      sf_wip_acct = wo_acct
      sf_wip_sub = wo_sub
      sf_wip_cc = wo_cc.

   for first si_mstr
         fields (si_entity si_site)
         where si_site = wo_site no-lock:
   end. /* FOR FIRST SI_MSTR */
   sf_entity = si_entity.

   if dpt_lbr_acct <> "" then
   assign sf_lbr_acct = dpt_lbr_acct
      sf_lbr_sub = dpt_lbr_sub
      sf_lbr_cc = dpt_lbr_cc.

   if dpt_bdn_acct <> "" then
   assign sf_bdn_acct = dpt_bdn_acct
      sf_bdn_sub = dpt_bdn_sub
      sf_bdn_cc = dpt_bdn_cc.

   if dpt_lvar_acc <> "" then
   assign lbr_use_acct = dpt_lvar_acc
      lbr_use_sub = dpt_lvar_sub
      lbr_use_cc = dpt_lvar_cc.

   if dpt_bvar_acc <> "" then
   assign bdn_use_acct = dpt_bvar_acc
      bdn_use_sub = dpt_bvar_sub
      bdn_use_cc = dpt_bvar_cc.

   if dpt_lvrr_acc <> "" then
   assign lbr_rate_acct = dpt_lvrr_acc
      lbr_rate_sub = dpt_lvrr_sub
      lbr_rate_cc = dpt_lvrr_cc.

   if dpt_bvrr_acc <> "" then
   assign bdn_rate_acct = dpt_bvrr_acc
      bdn_rate_sub = dpt_bvrr_sub
      bdn_rate_cc = dpt_bvrr_cc.

   /*GET ACTUAL LABOR RATE*/

   pay_rate = if run_labor then wc_lbr_rate else wc_setup_rte.

   for first emp_mstr
         fields (emp_addr emp_pay_rate emp_pay_type)
         where emp_addr = emp no-lock:
   end. /* FOR FIRST EMP_MSTR */

   if available emp_mstr and emp_pay_type = "HR" and emp_pay_rate <> 0
   then do:
      pay_rate = emp_pay_rate.

      if earn_code <> "" then do:

         for first ea_mstr
               fields (ea_earn ea_rate)
               where ea_earn = earn_code no-lock:
         end. /* FOR FIRST EA_MSTR */
         if available ea_mstr then
            pay_rate = pay_rate * ea_rate.
      end.
   end.

   /*CALCULATE LABOR AMOUNTS*/

   lbr_act_amt = pay_rate * act_lbr_hrs.
   /* ROUND PER BASE CURRENCY ROUND METHOD */

   run gpcrnd (input-output lbr_act_amt,input gl_rnd_mthd).

   lbr_wc_std_amt =
   (if run_labor then wc_lbr_rate else wc_setup_rte) * act_lbr_hrs.
   /* ROUND PER BASE CURRENCY ROUND METHOD */

   run gpcrnd (input-output lbr_wc_std_amt,input gl_rnd_mthd).

   lbr_cumorder_std_amt =
   (if run_labor then wr_lbr_rate else wr_setup_rte) * act_lbr_hrs.
   /* ROUND PER BASE CURRENCY ROUND METHOD */

   run gpcrnd (input-output lbr_cumorder_std_amt,input gl_rnd_mthd).

   assign
      lbr_rate_var = lbr_act_amt - lbr_wc_std_amt
      lbr_method_var = lbr_wc_std_amt - lbr_cumorder_std_amt.

   /*CALCULATE BURDEN AMOUNTS*/

   routing = if wo_routing = "" then wo_part else wo_routing.

   for last ro_det
         fields (ro_mch_op ro_op ro_routing ro_start)
         where ro_routing = routing
         and ro_op = wr_op
         and ro_start <= eff_date no-lock:
   end. /* FOR LAST RO_DET */

   if not available ro_det then do:

      for last ro_det
            fields (ro_mch_op ro_op ro_routing ro_start)
            where ro_routing = routing
            and ro_op = wr_op
            and ro_start = ? no-lock:
      end. /* FOR LAST RO_DET */
   end.

   if available ro_det then mch_op = ro_mch_op.
   else mch_op = wc_mch_op.

   /* RUN BURDEN CALCULATIONS */
   if run_labor then do:
      /*! CALCULATE OPERATION RUN BURDEN USING THE STANDARD       *
      *  EQUATION. IN THIS CASE WE USE ORDER QUANTITY = 1,       *
      *  YIELD = 100%. ACTUAL RUN BURDEN.                        */
      {gprun.i ""rwbdncal.p""
         "( input 'RUN'                /* BURDEN COST TYPE */,
                           input no                  /* ACCUMULATE TOTAL? */,
                           input (wc_bdn_pct * 0.01)    /* BURDEN PERCENT */,
                           input wc_bdn_rate               /* BURDEN RATE */,
                           input pay_rate                   /* LABOR RATE */,
                           input wc_mch_bdn        /* MACHINE BURDEN RATE */,
                           input 0                       /* MACHINES USED */,
                           input 1                      /* ORDER QUANTITY */,
                           input act_lbr_hrs             /* UNIT RUN TIME */,
                           input 0                          /* SETUP RATE */,
                           input 0                          /* SETUP TIME */,
                           input 1                       /* YIELD PERCENT */,
                           input-output bdn_act_amt        /* BURDEN COST */
                         )"
         }
/*GUI*/ if global-beam-me-up then undo, leave.

      /* ROUND PER BASE CURRENCY ROUND METHOD */

      run gpcrnd (input-output bdn_act_amt ,input gl_rnd_mthd).

      /*! CALCULATE OPERATION RUN BURDEN USING THE STANDARD       *
      *  EQUATION. IN THIS CASE WE USE ORDER QUANTITY = 1,       *
      *  YIELD = 100%.  STANDARD WORK CENTER RUN BURDEN.         */
      {gprun.i ""rwbdncal.p""
         "( input 'RUN'                /* BURDEN COST TYPE */,
                           input no                  /* ACCUMULATE TOTAL? */,
                           input (wc_bdn_pct * 0.01)    /* BURDEN PERCENT */,
                           input wc_bdn_rate               /* BURDEN RATE */,
                           input wc_lbr_rate                /* LABOR RATE */,
                           input wc_mch_bdn        /* MACHINE BURDEN RATE */,
                           input 0                       /* MACHINES USED */,
                           input 1                      /* ORDER QUANTITY */,
                           input act_lbr_hrs             /* UNIT RUN TIME */,
                           input 0                          /* SETUP RATE */,
                           input 0                          /* SETUP TIME */,
                           input 1                       /* YIELD PERCENT */,
                           input-output bdn_wc_std_amt     /* BURDEN COST */
                         )"
         }
/*GUI*/ if global-beam-me-up then undo, leave.

      /* ROUND PER BASE CURRENCY ROUND METHOD */

      run gpcrnd (input-output bdn_wc_std_amt,input gl_rnd_mthd).

      /*! CALCULATE OPERATION RUN BURDEN USING THE STANDARD       *
      *  EQUATION. IN THIS CASE WE USE ORDER QUANTITY = 1,       *
      *  YIELD = 100%. CUMULATIVE ORDER RUN BURDEN.              */
      {gprun.i ""rwbdncal.p""
         "( input 'RUN'                /* BURDEN COST TYPE */,
                           input no                  /* ACCUMULATE TOTAL? */,
                           input (wr_bdn_pct * 0.01)    /* BURDEN PERCENT */,
                           input wr_bdn_rate               /* BURDEN RATE */,
                           input wr_lbr_rate                /* LABOR RATE */,
                           input wr_mch_bdn        /* MACHINE BURDEN RATE */,
                           input 0                       /* MACHINES USED */,
                           input 1                      /* ORDER QUANTITY */,
                           input act_lbr_hrs             /* UNIT RUN TIME */,
                           input 0                          /* SETUP RATE */,
                           input 0                          /* SETUP TIME */,
                           input 1                       /* YIELD PERCENT */,
                           input-output bdn_cumorder_std_amt    /* BURDEN */
                         )"
         }
/*GUI*/ if global-beam-me-up then undo, leave.

      /* ROUND PER BASE CURRENCY ROUND METHOD */

      run gpcrnd (input-output bdn_cumorder_std_amt,input gl_rnd_mthd).

   end.
   /* SETUP BURDEN CALCULATIONS */
   else do:
      /*! CALCULATE OPERATION SETUP BURDEN USING THE STANDARD     *
      *  EQUATION.  IN THIS CASE WE USE ORDER QUANTITY = 1,      *
      *  YIELD % = 100%.  ACTUAL WORK CENTER SETUP BURDEN.       */
      {gprun.i ""rwbdncal.p""
         "( input 'SETUP'              /* BURDEN COST TYPE */,
                           input no                  /* ACCUMULATE TOTAL? */,
                           input (wc_bdn_pct * 0.01)    /* BURDEN PERCENT */,
                           input wc_bdn_rate               /* BURDEN RATE */,
                           input 0                          /* LABOR RATE */,
                           input wc_mch_bdn        /* MACHINE BURDEN RATE */,
                           input mch_op                  /* MACHINES USED */,
                           input 1                      /* ORDER QUANTITY */,
                           input 0                       /* UNIT RUN TIME */,
                           input pay_rate                   /* SETUP RATE */,
                           input act_lbr_hrs                /* SETUP TIME */,
                           input 1                       /* YIELD PERCENT */,
                           input-output bdn_act_amt        /* BURDEN COST */
                         )"
         }
/*GUI*/ if global-beam-me-up then undo, leave.

      /* ROUND PER BASE CURRENCY ROUND METHOD */

      run gpcrnd (input-output bdn_act_amt,input gl_rnd_mthd).

      /*! CALCULATE OPERATION SETUP BURDEN USING THE STANDARD     *
      *  EQUATION.  IN THIS CASE WE USE ORDER QUANTITY = 1,      *
      *  YIELD % = 100%.  STANDARD WORK CENTER SETUP BURDEN.     */
      {gprun.i ""rwbdncal.p""
         "( input 'SETUP'              /* BURDEN COST TYPE */,
                           input no                  /* ACCUMULATE TOTAL? */,
                           input (wc_bdn_pct * 0.01)    /* BURDEN PERCENT */,
                           input wc_bdn_rate               /* BURDEN RATE */,
                           input 0                          /* LABOR RATE */,
                           input wc_mch_bdn        /* MACHINE BURDEN RATE */,
                           input mch_op                  /* MACHINES USED */,
                           input 1                      /* ORDER QUANTITY */,
                           input 0                       /* UNIT RUN TIME */,
                           input wc_setup_rte               /* SETUP RATE */,
                           input act_lbr_hrs                /* SETUP TIME */,
                           input 1                       /* YIELD PERCENT */,
                           input-output bdn_wc_std_amt     /* BURDEN COST */
                         )"
         }
/*GUI*/ if global-beam-me-up then undo, leave.

      /* ROUND PER BASE CURRENCY ROUND METHOD */

      run gpcrnd (input-output bdn_wc_std_amt,input gl_rnd_mthd).

      /*! CALCULATE OPERATION SETUP BURDEN USING THE STANDARD     *
      *  EQUATION.  IN THIS CASE WE USE ORDER QUANTITY = 1,      *
      *  YIELD % = 100%.  CUMULATIVE ORDER SETUP BURDEN.         */
      {gprun.i ""rwbdncal.p""
         "( input 'SETUP'              /* BURDEN COST TYPE */,
                           input no                  /* ACCUMULATE TOTAL? */,
                           input (wr_bdn_pct * 0.01)    /* BURDEN PERCENT */,
                           input wr_bdn_rate               /* BURDEN RATE */,
                           input 0                          /* LABOR RATE */,
                           input wr_mch_bdn        /* MACHINE BURDEN RATE */,
                           input wr_mch_op               /* MACHINES USED */,
                           input 1                      /* ORDER QUANTITY */,
                           input 0                       /* UNIT RUN TIME */,
                           input wr_setup_rte               /* SETUP RATE */,
                           input act_lbr_hrs                /* SETUP TIME */,
                           input 1                       /* YIELD PERCENT */,
                           input-output bdn_cumorder_std_amt    /* BURDEN */
                         )"
         }
/*GUI*/ if global-beam-me-up then undo, leave.

      /* ROUND PER BASE CURRENCY ROUND METHOD */

      run gpcrnd (input-output bdn_cumorder_std_amt,input gl_rnd_mthd).

   end.

   assign
      bdn_rate_var = bdn_act_amt - bdn_wc_std_amt
      bdn_method_var = bdn_wc_std_amt - bdn_cumorder_std_amt.

   /*AVERAGE COSTING STUFF*/
   {gprun.i ""csavg01.p"" "(input wo_part,
                                     input wo_site,
                                     output glx_set,
                                     output glx_mthd,
                                     output cur_set,
                                     output cur_mthd)"}
/*GUI*/ if global-beam-me-up then undo, leave.


   if glx_mthd = "AVG" then do:
      assign
         lbr_cumorder_std_amt = lbr_act_amt
         lbr_rate_var = 0
         lbr_method_var = 0
         bdn_cumorder_std_amt = bdn_act_amt
         bdn_rate_var = 0
         bdn_method_var = 0.
   end.

   /*POST STANDARD LABOR*/

   assign
      op_recno   = ophist_recid
      opgltype   = "LBR-2000"
      sf_dr_acct = sf_wip_acct
      sf_dr_sub  = sf_wip_sub
      sf_dr_cc   = sf_wip_cc
      sf_cr_acct = sf_lbr_acct
      sf_cr_sub  = sf_lbr_sub
      sf_cr_cc   = sf_lbr_cc
      sf_gl_amt  = lbr_cumorder_std_amt.
   {gprun.i ""sfopgl.p""}
/*GUI*/ if global-beam-me-up then undo, leave.


   /*POST LABOR RATE VARIANCE*/

   assign
      op_recno = ophist_recid
      opgltype = "LBR-2001"
      sf_dr_acct = lbr_rate_acct
      sf_dr_sub  = lbr_rate_sub
      sf_dr_cc = lbr_rate_cc
      sf_cr_acct = sf_lbr_acct
      sf_cr_sub  = sf_lbr_sub
      sf_cr_cc = sf_lbr_cc
      sf_gl_amt = lbr_rate_var.
   {gprun.i ""sfopgl.p""}
/*GUI*/ if global-beam-me-up then undo, leave.


   /*POST METHOD CHANGE VARIANCE DUE TO LABOR*/

   assign
      op_recno = ophist_recid
      opgltype = "MTH-1000"
      sf_cr_acct = sf_lbr_acct
      sf_cr_sub  = sf_lbr_sub
      sf_cr_cc = sf_lbr_cc
      sf_gl_amt = lbr_method_var.

         {gprun.i ""glactdft.p"" "(input ""WO_WVAR_ACCT"",
                                   input pl_prod_line,
                                   input wo_site,
                                   input """",
                                   input """",
                                   input no,
                                   output sf_dr_acct,
                                   output sf_dr_sub,
                                   output sf_dr_cc)"}
/*GUI*/ if global-beam-me-up then undo, leave.

   {gprun.i ""sfopgl.p""}
/*GUI*/ if global-beam-me-up then undo, leave.


   /*POST STANDARD BURDEN*/

   assign
      op_recno = ophist_recid
      opgltype = "BDN-2000"
      sf_dr_acct = sf_wip_acct
      sf_dr_sub  = sf_wip_sub
      sf_dr_cc = sf_wip_cc
      sf_cr_acct = sf_bdn_acct
      sf_cr_sub  = sf_bdn_sub
      sf_cr_cc = sf_bdn_cc
      sf_gl_amt = bdn_cumorder_std_amt.
   {gprun.i ""sfopgl.p""}
/*GUI*/ if global-beam-me-up then undo, leave.


   /*POST BURDEN RATE VARIANCE*/

   assign
      op_recno = ophist_recid
      opgltype = "BDN-2001"
      sf_dr_acct = bdn_rate_acct
      sf_dr_sub  = bdn_rate_sub
      sf_dr_cc = bdn_rate_cc
      sf_cr_acct = sf_bdn_acct
      sf_cr_sub  = sf_bdn_sub
      sf_cr_cc = sf_bdn_cc
      sf_gl_amt = bdn_rate_var.
   {gprun.i ""sfopgl.p""}
/*GUI*/ if global-beam-me-up then undo, leave.


   /*POST METHOD CHANGE VARIANCE DUE TO BURDEN*/

   assign
      op_recno = ophist_recid
      opgltype = "MTH-2000"
      sf_cr_acct = sf_bdn_acct
      sf_cr_sub  = sf_bdn_sub
      sf_cr_cc = sf_bdn_cc
      sf_gl_amt = bdn_method_var.

         {gprun.i ""glactdft.p"" "(input ""WO_WVAR_ACCT"",
                                   input pl_prod_line,
                                   input wo_site,
                                   input """",
                                   input """",
                                   input no,
                                   output sf_dr_acct,
                                   output sf_dr_sub,
                                   output sf_dr_cc)"}
/*GUI*/ if global-beam-me-up then undo, leave.


   {gprun.i ""sfopgl.p""}
/*GUI*/ if global-beam-me-up then undo, leave.


   /*SET OP_HIST FIELDS*/

   find op_hist where recid(op_hist) = ophist_recid exclusive-lock.

   assign
      op_bdn_cost = bdn_act_amt
      op_bdn_std  = bdn_cumorder_std_amt
      op_earn     = earn_code
      op_lbr_cost = lbr_act_amt
      op_lbr_std  = lbr_cumorder_std_amt.

   if run_labor then op_act_run = act_lbr_hrs.
   else op_act_setup = act_lbr_hrs.

   /*UPDATE CUM ORDER*/

   find wo_mstr where wo_lot = cumwo_lot exclusive-lock.
   find wr_route where wr_lot = wo_lot and wr_op = cumwo_op
      exclusive-lock.

   assign
      wr_lbr_std = wr_lbr_std + lbr_cumorder_std_amt
      wr_lbr_act = wr_lbr_act + lbr_act_amt
      wr_bdn_std = wr_bdn_std + bdn_cumorder_std_amt
      wr_bdn_act = wr_bdn_act + bdn_act_amt

      wo_wip_tot = wo_wip_tot + lbr_cumorder_std_amt +
      bdn_cumorder_std_amt.

   if run_labor then
      wr_act_run = wr_act_run + act_lbr_hrs.
   else
      wr_act_setup = wr_act_setup + act_lbr_hrs.

end.
